<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

     
class sfTdTemplate extends sfTdBase {
    
    /**
     * Constructor.
     *
     * Available options:
     *
     *  * id_format:       The format for the generated HTML id attributes (%s by default)
     *  * is_hidden:       true if the form widget must be hidden, false otherwise (false by default)
     *  * default:         The default value to use when rendering the widget
     *  * title:           The title to use when the widget is rendered
     *  * link:            The link of the widget
     *  * template:        The template for render td
     * 
     * @param array $options     An array of options
     * @param array $attributes  An array of default HTML attributes
     *
     * @see sfWidget
     */
    public function __construct($options = array(), $attributes = array())
    {
      $this->addOption('template', null);     
      parent::__construct($options, $attributes);
    }    
    
    /**
     * Sets the template for the widget.
     *
     * @param string $value The template
     *    *
     * @return sfWidget The current widget instance
     */

      public function setTemplate($template) {
          $this->setOption('template', $template);     
          return $this;
      }

     /**
     * Returns the text for the widget.
     *
     * @return string The template
     */

    public function getTemplate() {
      return $this->getOption('template');
    }

    public function isModelTd() {
        return false;
    }
    
    public function render() {
        if(!$this->isHidden())
            return parent::render(strtr($this->template,$this->parent->trans));
        else 
            return '';
    }
    
}


?>
